<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>队伍管理</title>
    <%@include file="../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
</head>
<body>
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <section>
        <div class="section-main">
            <div class="layui-tab layui-tab-brief mt20">
                <ul class="layui-tab-title">
                    <li>个人排行</li>
                    <li class="layui-this">队伍排行</li>
                </ul>
                <div class="layui-tab-item  layui-show">
                    <form class="layui-form" action="${ctx}/sign/group/rankList.do?projectId=${groupAuthor.projectId}" id="myForm" method="post">
                        <input type="hidden" name="pageNo" id="pageNo"/>
                        <div class="f-search-bar">
                            <div class="search-container">
                                <ul class="search-form-content">
                                    <li class="form-item-inline"><label class="search-form-lable">队伍名称</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="name" autocomplete="off" class="layui-input"
                                                   value="${groupAuthor.name}" placeholder="队伍名称"
                                            >
                                        </div>
                                    </li>
                                    <li class="form-item"><label class="search-form-lable">时间</label>
                                        <div class="check-btn-inner">
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),0,'#myForm')" ${empty type || type == 0 ? 'class="active"' : ''}>今日</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),4,'#myForm')" ${type == 4 ? 'class="active"' : ''}>昨日</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),1,'#myForm')" ${type == 1 ? 'class="active"' : ''}>本周</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),2,'#myForm')" ${type == 2 ? 'class="active"' : ''}>本月</a>
                                            <a href="javascript:void(0);" onclick="setTimeType($(this),3,'#myForm')" ${type == 3 ? 'class="active"' : ''}>历史</a>
                                            <input type="hidden" name="type" value="${type}" />
                                        </div>
                                    </li>
                                    <li class="form-item-inline">
                                        <div class="sub-btns">
                                            <a class="layui-btn layui-btn-danger"
                                               href="javascript:submitFunction('#myForm')">查询</a>
                                            <a class="layui-btn layui-btn-normal"
                                               href="javascript:resetFunction('#myForm')">重置</a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>

                    <div class="my-act-list-content">
                        <div class="cl">
                            <table class="layui-table">
                                <colgroup>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>队伍名称</th>
                                    <th>成员数</th>
                                    <td>步数</td>
                                    <td>操作</td>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="group" items="${groupList}">
                                    <tr>
                                        <td>${group.rank}</td>
                                        <td>${group.name}</td>
                                        <td>${group.memberNum}</td>
                                        <td>${group.stepNum}</td>
                                        <td>
                                            <a href="${ctx}/sign/member/group/rankList.do?projectId=${group.projectId}&groupId=${group.id}">查看团队人员排名</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        <div class="page-content">
                            <div id="page_content" class="page-container"></div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item"></div>
            </div>
        </div>
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    $(function () {
//加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        layui.use(['laydate', 'element'], function () {
            var laydate = layui.laydate, element = layui.element;;
            // 查询发布日期
            var start = {
                elem: 'input[name=startDate]'
            };

            var end = {
                elem: 'input[name=endDate]'
            };
            laydate.render(start);
            laydate.render(end);

            element.on('tab', function (data) {
                if (data.index == 0) {
                    window.location.href = "${ctx}/sign/member/rankList.do?projectId=${signProject.id}";
                }
                else if (data.index == 1) {
                    window.location.href = "${ctx}/sign/group/rankList.do?projectId=${signProject.id}";
                }
            });
        });
    })

</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '我发布的打卡项目',
            href: '${ctx}/sign/project/list.do'
        }, {
            name: '${signProject.title}',
            href: '${ctx}/sign/project/list.do'
        }, {
            name: '数据查看',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: '${ctx}/sign/project/list.do',
            icon: 'back'
        }]
    });
</script>
</body>
</html>
